package licode.unisop.platform.client.feign.impl;

import licode.unisop.platform.client.api.SiPlatformQueryService;
import licode.unisop.platform.client.feign.PlatformQueryApiFeign;
import licode.unisop.provider.info.*;
import licode.unisop.provider.vo.*;
import licode.unisop.unilite.utils.TryMethodCall;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * 实现接口Feign调用
 *
 * @author licode
 */
@Component
public class SiPlatformQueryServiceFeignImpl implements SiPlatformQueryService {
    @Resource
    private PlatformQueryApiFeign platformQueryApiFeign;


    @Override
    public SiPlatform lookupPlatform(SiPlatIdFind findInfo) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findPlatform(findInfo));
    }

    @Override
    public SiAssetEntry lookupAssetInfo(SiAssetId idFind) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAsset(idFind));
    }

    @Override
    public SiAssetBrief lookupAssetBrief(SiAssetLookupIn lookupIn) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.lookupAssetBrief(lookupIn));
    }

    @Override
    public Long getSubAssetCount(SiAssetLookupIn lookupIn) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.getSubAssetCount(lookupIn));
    }

    @Override
    public List<SiAssetKey> findAssetKeys(SiAssetId idFind) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAssetKeys(idFind));
    }

    @Override
    public SiAssetInfo getPlatformAssets(SiPlatIdFind plInfo) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.getPlatformAssets(plInfo));
    }

    @Override
    public SiAssetBrief lookupAssetByCode(SiLookupAssetByCodeIn lookupIn) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.lookupAssetByCode(lookupIn));
    }

    @Override
    public SiAssetBrief lookupAuthAssetByCode(SiAssetCodeLookupIn req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.lookupAuthAssetByCode(req));
    }

    @Override
    public List<SiAssetBrief> queryAssetsByCode(SiAssetCodeQueryIn req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.queryAssetsByCode(req));
    }

    @Override
    public SiAssetHold getUserAssets(SiHoldInfo userInfo) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.getUserAssets(userInfo));
    }

    @Override
    public SiAssetHold getHoldAssets(SiHoldInfo holdInfo) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.getHoldAssets(holdInfo));
    }

    @Override
    public SiPageResult<SiPlatform> findPlatformPage(PlatPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findPage(req));
    }

    @Override
    public SiPageResult<String> findAuthPlatformPage(AuthPlatPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAuthPlatformPage(req));
    }

    @Override
    public List<SiAssetBrief> findAssetList(AssetListInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAssetList(req));
    }

    @Override
    public SiPageResult<SiAssetRelation> findHoldRelAssetPage(HoldAssetPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findHoldRelAssetPage(req));
    }

    @Override
    public SiPageResult<SiAssetRelation> findAssetRelHoldPage(AssetHoldPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAssetRelHoldPage(req));
    }

    @Override
    public SiPageResult<SiAssetBrief> findAssetPage(AssetPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAssetPage(req));
    }

    @Override
    public SiPageResult<SiAssetBrief> findHoldAssetPage(HoldAssetPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findHoldAssetPage(req));
    }

    @Override
    public SiPageResult<SiAssetBrief> findAssetHoldPage(AssetHoldPageInfo req) {
        return TryMethodCall.execFeign(() -> platformQueryApiFeign.findAssetHoldPage(req));
    }
}
